package com.zwh.service;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.zwh.dao.AlbumDAO;
import com.zwh.entity.Album;
import com.zwh.entity.Chapter;
import com.zwh.entity.PageDTO;

import javax.annotation.Resource;

@Service("albumService")
@Transactional
public class AlbumServiceImpl implements AlbumService {
	@Resource
	private AlbumDAO albumDAO;
	@Override
	public PageDTO<Album> selectAlbum(int page, int rows) {
		PageDTO<Album> pageDTO = new PageDTO<Album>();
		int start=page*rows-rows;
		pageDTO.setRows(albumDAO.selectAlbum(start,rows));
		pageDTO.setTotal(albumDAO.count());
		
		return pageDTO;
	}

	@Override
	public void updatePassword(Integer id, String password) {
		// TODO Auto-generated method stub

	}

	@Override
	public void addAlbum(Album album) {
		albumDAO.addAlbum(album);

	}

	@Override
	public void deleteAlbum(Integer id) {
		// TODO Auto-generated method stub

	}

	@Override
	public void deleteAlbums(Integer[] ids) {
		// TODO Auto-generated method stub

	}

	@Override
	public List<Album> selectAlbumAll() {
		
		return albumDAO.selectAlbumAll();
	}

	@Override
	public void addChapter(Chapter chapter) {
		albumDAO.addChapter(chapter);
		
	}

}
